import java.util.*;
import java.io.*;

public class KeboardProducer extends Thread{
	protected SynchronizedBuffer keyboards = new SynchronizedBuffer();
	
	public KeboardProducer(SynchronizedBuffer key) {
		keyboards=key;
	}
	  

	  protected void produce() {
	      int len = 0;

	      KeboardCandidate key=new KeboardCandidate(KeboardCandidate.getKeyboardCount());
	      keyboards.add(key);
	      len = keyboards.size();	     	   
	      System.out.println("List size now " + len);
	  }
	  
	  public void run(){
		  while(true){
			  this.produce();
		  }
	  }
	  
	  
	  public static void main(String[] args) throws IOException {
		SynchronizedBuffer keyboards = new SynchronizedBuffer();
		  
		KeboardProducer prod = new KeboardProducer(keyboards);
	    KeboardConsumer con = new KeboardConsumer(keyboards);
	    //KeboardConsumer con2 = new KeboardConsumer(keyboards);
	    
	   prod.start();
	   prod.setName("producer");
	   con.setName("consumer");
	   con.start();
	  //  while (true) {
	       //prod.produce();
	       //con.consume();
	      // con2.consume();
	    //  }
	    
	  }
	  


}






